<template>
    <div class="book-component">
        <a :href="href">
            <div class="img-box">
                <img :src="src" :alt="alt">
            </div>
            <div class="img-detail">
                <div class="name">{{ name }}</div>
                <p class="author">{{ author }}</p>
            </div>
        </a>
    </div>
</template>
<script setup>
const props = defineProps({
    src: {
        type: String,
        default: "https://media.codecore.cn/error-img.png"
    },
    alt: {
        type: String,
        default: "图片"
    },
    name: {
        type: String,
        default: "[ 未登记名称 ]"
    },
    author: {
        type: String,
        default: "[ 未登记作者 ]"
    },
    href: {
        type: String,
        default: "./",//round
    },
    type: {
        type: String,
        default: "square",//round
    }
})

</script>
<style scoped>
.book-component {
    background-color: var(--c-bg);
    border: 1px solid var(--c-border);
}

a {
    color: var(--c-text);
}

.book-component {
    display: inline-block;
}

.book-component .img-box {
    height: 280px;
    text-align: center;
    background-color: var(--c-bg);
    /* #fcfcfc; */
}

html.dark .book-component .img-box {
    background-color: var(--c-bg);
}


.book-component img {
    width: 181px;
    margin: 15px auto;
}

.book-component img:hover {
    box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.6);
}

html.dark .book-component img:hover {
    box-shadow: 4px 4px 20px rgba(255, 255, 255, 0.6);
}


.book-component .img-detail {
    border-top: 1px solid var(--c-border);
    background-color: var(--c-bg);
    height: 118px;
}

.book-component .name {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: break-word;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    padding-left: 1rem;
    padding-right: 1rem;
    overflow: hidden;
}

.book-component .author {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media screen and (max-width:700px) {
    .book-component {
        width: 100%;
    }

    .book-component .img-box {
        height: 30rem;
    }

    .book-component .img-box img {
        width: 20rem;
        height: 28rem;
        margin: 1rem auto;
    }
}

@media screen and (min-width:980px) {
    .book-component {
        width: 220px;
        margin: 0 .5rem .5rem;
    }
}
</style>